package Pantallas;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.ListModel;
import javax.swing.SwingUtilities;
import javax.swing.border.BevelBorder;
import javax.swing.border.LineBorder;

import Clases.Estudiante;
import Clases.Seccion;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class Promedio extends javax.swing.JDialog {
	Seccion sec;
	private JLabel jLabel2;
	private JButton jButton1;
	private JPanel jPanel1;
	private JLabel jLabel3;
	private JLabel jLabel1;

	/**
	* Auto-generated main method to display this JDialog
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				JFrame frame = new JFrame();
				Promedio inst = new Promedio(frame);
				inst.setVisible(true);
			}
		});
	}
	
	public Promedio(JFrame frame) {
		super(frame);
		initGUI();
	}
	
	public Promedio(JFrame frame,Seccion sec) {
		super(frame);
		initGUI();
		this.sec=sec;
	}
	
	private void initGUI() {
		try {
			{
				getContentPane().setLayout(null);
				{
					jLabel1 = new JLabel();
					getContentPane().add(jLabel1);
					jLabel1.setText("Promedio:");
					jLabel1.setBounds(57, 92, 83, 15);
				}
				{
					jLabel2 = new JLabel();
					getContentPane().add(jLabel2);
					jLabel2.setText("");
					jLabel2.setBounds(138, 90, 132, 21);
					jLabel2.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));

				}
				{
					jButton1 = new JButton();
					getContentPane().add(jButton1);
					jButton1.setText("Volver");
					jButton1.setBounds(144, 138, 99, 22);
					jButton1.setIcon(new ImageIcon(getClass().getClassLoader().getResource("imagenes/icono-flecha-izq.gif.png")));
					jButton1.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							System.out.println("jButton1.actionPerformed, event="+evt);
							//TODO add your code for jButton1.actionPerformed
						dispose();
						}
					});
				}
				{
					jLabel3 = new JLabel();
					getContentPane().add(jLabel3);
					jLabel3.setText("Promedio de la Seccion");
					jLabel3.setBounds(57, 36, 278, 15);
					jLabel3.setFont(new java.awt.Font("Segoe UI",1,18));
				}
				{
					jPanel1 = new JPanel();
					getContentPane().add(jPanel1);
					jPanel1.setBounds(22, 69, 312, 57);
					jPanel1.setBorder(BorderFactory.createTitledBorder(""));
				}
				this.addWindowListener(new WindowAdapter() {
					public void windowOpened(WindowEvent evt) {
						System.out.println("this.windowOpened, event="+evt);
						//TODO add your code for this.windowOpened
						jLabel2.setText(""+sec.PromedioNotas());
					}
				});
			}
			this.setSize(388, 210);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
